/**
 * 
 */
package com.sad.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.StringUtils;

import com.sad.controller.action.ActionManager;
import com.sad.controller.action.IAction;

/**
 * 
 * 一个简单的MVC
 * 
 * @author zhaoqy
 *
 */
public class MainController extends HttpServlet {

	private static final long serialVersionUID = 8299268152401596458L;

	public void service(HttpServletRequest request, HttpServletResponse response)
			throws IOException, ServletException {

		String pageid = StringUtils.defaultString(request.getParameter("pageid"), "index");

		IAction p = ActionManager.allo(pageid);
		p.handle(request, response);
	}
}
